<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
import store from "@/store"
import { storage } from "@/utils/Storage"
export default {
  name: "App",
  setup() {
    // 刷新时保存store内数据
    const storageStoreData = storage.get("m-store-data")
    if (storageStoreData) {
      store.replaceState(Object.assign({}, store.state, storageStoreData))
    }
    window.addEventListener("beforeunload", () => {
      storage.set("m-store-data", store.state)
    })
  },
}
</script>
<style></style>
